package com.xiao.hao.enums;


import cn.hutool.core.collection.CollUtil;
import com.xiao.hao.resp.BaseEnums;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.List;

@Getter
@AllArgsConstructor
public enum CharacterTypeEnum {

    CharacterTypeEnum_1("1", "爷爷"),
    CharacterTypeEnum_2("2", "奶奶"),
    CharacterTypeEnum_3("3", "儿子"),
    CharacterTypeEnum_4("4", "女儿"),
    CharacterTypeEnum_5("5", "老公"),
    CharacterTypeEnum_6("6", "老婆"),
    //    CharacterTypeEnum_7("7", "肌肉注射"),
    CharacterTypeEnum_8("8", "男孩"),
    CharacterTypeEnum_9("9", "女孩");


    private final String code;
    private final String name;

    public static String getNameByValue(String code) {
        for (CharacterTypeEnum typeEnum : values()) {
            if (typeEnum.getCode().equals(code)) {
                return typeEnum.getName();
            }
        }
        return null;
    }

    public static List<BaseEnums> getEnumRespList() {
        List<BaseEnums> respList = CollUtil.newArrayList();
        for (CharacterTypeEnum baseUnitEnum : values()) {
            respList.add(new BaseEnums(baseUnitEnum.getCode(), baseUnitEnum.getName()));
        }
        return respList;
    }


}
